<template>
  <div class="head">
    <van-pull-refresh
      v-model="isLoading"
      @refresh="onRefresh"
      head-height="100"
    >
      <div class="tab">
        <p>
          <van-icon
            name="arrow-left"
            size="48"
            color="#bababa"
            @click="$router.go(-1)"
          />
          <span>婚礼喜帖</span>
        </p>
      </div>
      <div class="tab-end">
        <van-icon name="music-o" size="60" color="#CECECE" class="music" />
        <audio autoplay="" loop="">
          <source
            src="https://music.163.com/song/media/outer/url?id=25657498.mp3"
          />
        </audio>
        <div class="tab-box">
          <div class="tab-box-top">
            <div class="tab-box-top-mid">
              <p></p>
              <p></p>
            </div>
            <p>爱意和珊珊的心事的婚礼，欢迎你来 参加</p>
            <span></span>
            <div class="hunli"></div>
            <p>2023-5-20 13:14我们一起见证</p>
          </div>
          <div
            class="tab-box-bottom"
            :style="{ backgroundColor: `rgb(${box},${col},${num})` }"
          ></div>
        </div>
        <p class="tab-p">距离婚礼开始还有：15分钟</p>
        <p class="tab-p-end">婚礼即将开始，请嘉宾入场</p>
      </div>
    </van-pull-refresh>
  </div>
</template>

<script>
export default {
  data() {
    return {
      box: "",
      col: "",
      num: "",
      timer: null,
      count: 0,
      isLoading: false,
    };
  },
  mounted() {
    this.timer = setInterval(() => {
      this.col = parseInt(Math.random() * 1000);
      this.col < 100 ? 100 : parseInt(Math.random() * 1000);
      this.num = parseInt(Math.random() * 1000);
      this.num < 100 ? 100 : parseInt(Math.random() * 1000);
      this.box = parseInt(Math.random() * 1000);
      this.box < 100 ? 100 : parseInt(Math.random() * 1000);
    }, 500);
  },
  methods: {
    onRefresh() {
      setTimeout(() => {
        this.$toast("刷新成功");
        this.isLoading = false;
        this.count++;
      }, 1000);
    },
  },
};
</script>

<style lang='scss' scoped>
.head {
  @-webkit-keyframes changeright {
    0% {
      -webkit-transform: rotate(0deg);
    }
    50% {
      -webkit-transform: rotate(180deg);
    }
    100% {
      -webkit-transform: rotate(360deg);
    }
  }
  .tab {
    height: 104px;
    background-color: #9a9a9a;
    padding-top: 26px;
    p {
      width: 440px;
      height: 44px;
      font-size: 32px;
      display: flex;
      justify-content: space-between;
      color: #ffffff;
    }
  }
  .tab-end {
    height: 100%;
    background-color: #ffffff;
    background-repeat: no-repeat;
    background-image: url(@/assets/img/home/Home-img/renwuimg/xtbjtutwo.png);
    background-size: 100% 100%;
    .music {
      margin: 40px 0 0 44px;
      -webkit-animation: changeright 3s linear infinite;
    }
    .tab-box {
      width: 570px;
      height: 702px;
      margin: 182px auto 0;
      z-index: 99;
      background-color: #efefef;
      position: relative;
      .tab-box-top {
        padding-top: 18px;
        span {
          display: block;
          width: 462px;
          border: 1px solid #cecece;
          margin: 88px auto 40px;
        }
        .tab-box-top-mid {
          width: 180px;
          height: 100px;
          display: flex;
          margin: 36px auto 30px;
          mix-blend-mode: multiply;
          p {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background-color: pink;
            background-image: url("../../../assets/img/home/Home-img/gxsix.png");
            background-repeat: no-repeat;
            background-size: 100% 100%;
          }
          :nth-child(2) {
            margin-left: -20px;
            background-image: url("../../../assets/img/home/Home-img/gxten.png");
          }
        }
        :nth-child(2) {
          width: 418px;
          margin: 0 auto;
          font-size: 26px;
          color: #bebebe;
        }
        :nth-child(4) {
          width: 462px;
          height: 262px;
          margin: 0 auto;
          font-size: 26px;
          background-color: #cecece;
        }
        :nth-child(5) {
          width: 418px;
          margin: 18px auto 0;
          font-size: 24px;
          text-align: center;
          color: #bebebe;
        }
        .hunli {
          background-image: url(@/assets/img/home/Home-img/renwuimg/xtonecenter.png);
          background-repeat: no-repeat;
          background-position: center center;
          background-size: 110% 110%;
        }
      }
      .tab-box-bottom {
        width: 570px;
        height: 702px;
        position: absolute;
        top: 0;
        z-index: -1;
        transform: rotateZ(5deg);
      }
    }
    .tab-p {
      text-align: center;
      margin: 170px auto 0;
      font-size: 30px;
      color: pink;
    }
    .tab-p-end {
      width: 670px;
      height: 88px;
      line-height: 88px;
      text-align: center;
      font-size: 30px;
      margin: 50px auto 0;
      background-color: deeppink;
      color: #ffffff;
      border-radius: 50px;
    }
  }
}
</style>